import { View } from "../../../mvc/core/View";
import { GameController } from "../../mvc/GameController";
import { AIManager } from "../../scene/ai/AIManager";
import { ObjCreate } from "../common/ObjCreate";
import { Language } from "../../../../extend/language/Language";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { Cache } from "../../cache/Cache";
import { ENpcEffect } from "../../../../Message/Public/ENpcEffect";
import { GTextFormat } from "../../../common/GTextFormat";
import { FontUtil } from "../../../common/font/FontUtil";
import { GTextArea } from "../../../../com/mui/controls/GTextArea";
import { TaskTargetInfo } from "../../model/TaskTargetInfo";
//class AttachedSoulBattlefieldRuleView
    
    export  class AttachedSoulBattlefieldRuleView extends View
    {
        constructor()
        {
            super();
            this.init();
            return;
        }

        /* internal  */closeBtnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            this.hide();
            return;
        }

        /* internal  */onLinkTxtHandler(arg1: Object /* flash.events.TextEvent */): void
        {
            GameController.attachedSoulBattlefield.view.hide();
            AIManager.onAutoPathAIControl(this._npcTarget);
            return;
        }

        /* internal  */init(): void
        {
            ObjCreate.createBg(0, 0, 250, 355, this);
            ObjCreate.createGTextField(Language.getString(28105), 9, 5, 80, 20, this, GlobalStyle._textFormat5);
            this._npcTarget = Cache.instance.scene.getNpcByEffect(ENpcEffect._ENPCEffectSpiritCoinChange);
            var loc1=GlobalStyle.setTextFormatLeading(new GTextFormat(FontUtil.songtiName, 14, 11661311), 5);
            this._rule = ObjCreate.createTextArea("", 9, 25, 240, 320, this);
            this._rule.textField.defaultTextFormat = loc1;
            this._rule.htmlText = Language.getString(28570);
            this._rule.addEventListener(flash.events.TextEvent.LINK, this.onLinkTxtHandler);
            var loc2=ObjCreate.createGButton("", 0, 0, 19, 19, null, "CloseButton");
            loc2.focusEnabled = true;
            loc2.configEventListener(flash.events.MouseEvent.CLICK, this.closeBtnClickHandler);
            ObjCreate.setObjAttri(loc2, 230, 1, -1, -1, this);
            return;
        }

        /* internal */ /* var */_rule: GTextArea;

        /* internal */ /* var */_npcTarget: TaskTargetInfo;
    }
